package com.wh.hotel.service.strategy.price;

import com.wh.hotel.po.PriceChangeVo;
import com.wh.hotel.util.PriceUtil;
import com.wh.hotel.vo.HotelPriceStrategyVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author wenhao
 */
@Slf4j
@Component
public class AbsolutePriceCalculator extends PriceCalculatorAbstract {
    @Override
    public Integer calculateBasePrice(Integer basePrice, HotelPriceStrategyVo strategyVo) {
        PriceChangeVo priceChangeVo = strategyVo.getPriceChangeVo();
        int orgPrice = basePrice + PriceUtil.yuan2Cent(priceChangeVo.getPriceGap());
        return Math.max(orgPrice, PriceUtil.yuan2Cent(1));
    }
}
